package Code.Day2_20240919.com.dx.day02;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @ClassName NightExam
 * @Description 晚测
 * @Author 12994
 * @Date 2024/9/19 22:47
 * @Version 1.0
 **/
public class NightExam {
    public static void main(String[] args) {
        // 使用数组计算学员的平均分
        Scanner input = new Scanner(System.in);
        System.out.print("请输入学员数量: ");
        int stuNum = input.nextInt();
        double[] list = new double[stuNum];
        for (int i = 0; i < list.length; i++) {
            System.out.printf("请输入第%d名学员的成绩: ", i + 1);
            list[i] = input.nextDouble();
        }
        System.out.printf("平均分是: %.2f", Arrays.stream(list).average().getAsDouble());
    }
}
